/**
 * Copyright &copy; 2012-2013 <a href="http://www.zhiqone.com">zhiqone</a> All rights reserved.
 */
package com.zcm.modules.center.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zcm.common.persistence.Page;
import com.zcm.common.service.CrudService;
import com.zcm.common.utils.DateUtils;
import com.zcm.modules.center.dao.CenterLogDao;
import com.zcm.modules.center.entity.CenterLog;

/**
 * 日志Service
 * @author liangstc
 * @version 2014-05-16
 */
@Service
@Transactional(readOnly = true)
public class CenterLogService extends CrudService<CenterLogDao, CenterLog> {

	
	public Page<CenterLog> findPage(Page<CenterLog> page, CenterLog log) {
		
		// 设置默认时间范围，默认当前月
		if (log.getBeginDate() == null){
			log.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1));
		}
		if (log.getEndDate() == null){
			log.setEndDate(DateUtils.addMonths(log.getBeginDate(), 1));
		}
		
		return super.findPage(page, log);
		
	}
	
}
